public class Student implements java.io.Serializable {
    private String name;
    private int age;
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) throws IllegalArgumentException {
        if (age < 0) {
            throw new IllegalArgumentException("年龄不得为负");
        }
        this.age = age;
    }
    public void introduce() {
        System.out.println("I am an student.");
    }
    public void study() {
        System.out.println("Student studying basic courses.");
    }
    @Override
    public String toString() {
        return "Student{" + "name='" + name + "'" + ", age=" + age + '}';
    }
    @Override
    public boolean equals(Object other) {
        if (this == other) {
            return true;
        }
        if (other == null || getClass() != other.getClass()) {
            return false;
        }
        Student student = (Student) other;
        return age == student.age && name.equals(student.name);
    }
}
